function login(){
	var identity = $("#identity").val();
	var user = $("[name=user]").val();
	var password = $("[name=password]").val();
	var reg = /^[0-9]+.?[0-9]*$/;
	var form = $("[name=form1]");
	if(identity == "请选择身份"){
		alert("请选择身份");
	}else if(identity == "学生"){
		if(user == null || user == undefined || user == "" || password == null || 
				password == undefined || password == ""){
			alert("用户名和密码框不能为空");
		}else if(!reg.test(user)){
			alert("请输入正确的用户名");
		}else{
			form.attr("action", "students_Servlet");
			$("<input type='hidden' name='action' value='login'>").appendTo(form);
			document.form1.submit();
		}
	}else{
		if(user == null || user == undefined || user == "" || password == null || 
				password == undefined || password == ""){
			alert("用户名和密码框不能为空");
		}else{
			form.attr("action", "teacher_Servlet");
			$("<input type='hidden' name='action' value='login'>").appendTo(form);
			document.form1.submit();
		}
	}
}
